package com.my.controller;

import com.my.common.result.R;
import com.my.service.UserService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author mars
 * @date 2025-03-28 10:22
 */
@RestController
@RequestMapping("/test")
public class TestController {

    private final UserService userService;

    /**
     *  构造注入
     *
     * @param userService userService
     */
    public TestController(UserService userService) {
        this.userService = userService;
    }

    @GetMapping("/getUsername")
    public R<String> test() {
        return R.success(userService.getUserName());
    }

}
